package dao;

import java.util.List;

import main.DataTransferObject;

public interface LocationDAO {
	
	/**
	 * Creates or updates a new ip if it does not exist.  Utilizes the 
	 * LocationService class.
	 * @param ip - IP to write to the database table.
	 * @return boolean of whether or not it successfully completed the transaction.
	 */
	public boolean createOrUpdate(String ip);
	
	/**
	 * Creates or updates an entry in the database based on the input DTO.  Updates
	 * based on the IP.
	 * 
	 * @param inDTO - Needs to have country, ip, city, and areacode populated.
	 * @return boolean of whether or not it successfully completed the transaction.
	 */
	public boolean createOrUpdate(DataTransferObject inDTO);
	
	/**
	 * Retrieve location information from the ip address if it exists there.  
	 * Returns <b>null</b> if ip is not found or if an error occurred.
	 * 
	 * @param ip  follows the form of "255.255.255.255"
	 * @return list of DTOs that have the location information populated.
	 */
	public DataTransferObject getLocationFromIP(String ip);
	
	/**
	 * Retrieves all the locations in the database and populates a list of the 
	 * DTOs.  If large database, this may be a long query.  
	 * @return
	 */
	public List<DataTransferObject> getAllLocations();
	
}
